View Javadoc

1   /*
2    * Copyright 2004-2005, University Health Network.  All rights reserved. Distributed under the BSD 
3    * license (see http://opensource.org/licenses/bsd-license.php).
4    *  
5    * ObjectWithEqualsAndHashCode.java
6    *
7    * Created on 9-Dec-2004 at 3:11:34 PM
8    */
9   package ca.uhn.cache.impl;
10  
11  import org.apache.commons.lang.builder.EqualsBuilder;
12  import org.apache.commons.lang.builder.HashCodeBuilder;
13  import org.apache.commons.lang.builder.ToStringBuilder;
14  
15  
16  /***
17   * Class with a default implementations for equals and hashCode and toString, which the use commong-lang
18   * <code>EqualsBuilder</code>, <code>HashCodeBuilder</code> and <code>ToStringBuidler</code>.
19   * 
20   * @author <a href="mailto:alexei.guevara@uhn.on.ca">Alexei Guevara</a>
21   * @version $Revision: 1.1 $ updated on $Date: 2005/01/24 22:52:37 $ by $Author: bryan_tripp $
22   */
23  public abstract class CommonsLangObject {
24  
25      /***
26       */
27      protected CommonsLangObject() {
28          super();
29      }
30      
31      /***
32       * {@inheritDoc}
33       */
34      public boolean equals( Object theObj ) {
35          return EqualsBuilder.reflectionEquals( this, theObj );
36      }
37      
38      
39      /***
40       * {@inheritDoc}
41       */
42      public int hashCode() {
43          return HashCodeBuilder.reflectionHashCode( this );
44      }
45      
46      
47      /***
48       * {@inheritDoc}
49       */
50      public String toString() {
51          return ToStringBuilder.reflectionToString( this );
52      }
53  
54  }